import type { PreviewOptions, ServerOptions } from 'vite'

export const server: ServerOptions = {
	hmr: true,
	host: '0.0.0.0',
	proxy: {
		'^(/api|/apis).*': {
			target: 'https://cnodejs.org',
			changeOrigin: true
			// rewrite: path => path.replace(/^\/apis/, '')
		},
		'/mel': {
			target: 'https://jiankang.baidu.com',
			changeOrigin: true
			// rewrite: path => path.replace(/^\/apis/, '')
		}
	}
}

export const preview: PreviewOptions = {
	proxy: {
		'^(/api|/apis).*': {
			target: 'https://cnodejs.org',
			changeOrigin: true
			// rewrite: path => path.replace(/^\/apis/, '')
		}
	},
	open: true
}
